package com.zhengxin.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.zhengxin.pojo.Employee;
import com.zhengxin.utils.UserContext;

public class AuthInterceptor extends AbstractInterceptor{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		// 获取session中的登录用户
		Employee emp=UserContext.get();
		if(emp != null){
			//如果没有登陆就不放行,就跳转到登陆页面
			return invocation.invoke();
		}
		//如果登陆就放行,就去到下一个拦截器或者下一个action
		return "input";
	}

}
